/*
 * @Author: hxt_caizhengxiang Czx12211001
 * @Date: 2025-04-23 20:57:11
 * @LastEditors: hxt_caizhengxiang Czx12211001
 * @LastEditTime: 2025-04-23 20:59:25
 * @FilePath: \Code\Bsp_Port\bsp_port.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#ifndef _BSP_PORT_H_
#define _BSP_PORT_H_

#include "main.h"
#include "stdio.h"
#include "string.h"
#include "stdbool.h"

/************************** GPIO *********************************/
#define LED_RUN_OPEN LL_GPIO_SetOutputPin(LED_RUN_GPIO_Port, LED_RUN_Pin)   // 打开运行指示灯
#define LED_RUN_SHUT LL_GPIO_ResetOutputPin(LED_RUN_GPIO_Port, LED_RUN_Pin) // 关闭运行指示灯
#define LED_RUN_TOGG LL_GPIO_TogglePin(LED_RUN_GPIO_Port, LED_RUN_Pin)      // 翻转运行指示灯
#define LED_RUN_ISIN LL_GPIO_IsInputPinSet(LED_RUN_GPIO_Port, LED_RUN_Pin)  // 读取运行指示灯

/************************** xxxx *********************************/
typedef enum
{
    BSP_UART1,
    BSP_UART2,
} Bsp_Uart_t;

typedef enum
{
    OFF_s, // 关闭
    ON_s,  // 打开
} switch_e;

#define bsp_mDelay(ms) LL_mDelay(ms)
void bsp_Delay_us(uint32_t us);
void bsp_uart_SendData(Bsp_Uart_t Uart, uint8_t *data, uint16_t datalen);
uint64_t get_Timestampus(void);
void bsp_timeBase_Handler(void);
int fputc(int ch, FILE *stream);
void bsp_USART_SendBytes(uint8_t *Buf, uint8_t length);
void bsp_IWDG_ReloadCounter(void);
uint8_t bsp_set_bit(uint8_t data, uint8_t Bit_Lie, uint8_t Bit_Num, uint8_t set_Data);
uint8_t bsp_get_bit(uint8_t data, uint8_t Bit_Lie, uint8_t Bit_Num);

void bsp_Ctrl_Circulate_Pump(switch_e state);
void bsp_Ctrl_Expel_Pump(switch_e state);
void bsp_Ctrl_Supply_Pump(switch_e state);
void bsp_Ctrl_Oxygen_Pump(switch_e state);
void bsp_Ctrl_Wave_Pump(switch_e state);
void bsp_Ctrl_Lamp(switch_e state);
void bsp_Ctrl_Down_Lamp(switch_e state);
void bsp_Ctrl_Feed_Device(switch_e state);
void bsp_Ctrl_Fishbowl_Heat(switch_e state);
void bsp_Ctrl_SupplyTub_Heat(switch_e state);
uint8_t bsp_Get_Waterline(void);

#endif

// Pump  泵
// Water 水
// Circulate 循环
// Expel 排出
// Supply 补给
// Oxygen 氧
// Lamp   灯
// Heat  加热
// Fishbowl 鱼缸
// Tub   桶
// Feed 喂食
// Read 读取
// Temp 温度
// Beep 蜂鸣器
// Clock 时钟
// Year 年
// Moon 月
// Day 日
// Hour 时
// Minute 分
// Seconds 秒
// Device    设备
// automatic// 自动
// Manual//手动
// Model//模式
// change//更换
// Add //添加
// Brew//酝酿
// Timing//定时
// Position//位置
// brightness//亮度
// wave //波浪
